const textEncode = new TextEncoder();

export function stringToUint8Array(
  inputText: string
): Uint8Array {
  return textEncode.encode(inputText);
}

export function getIsPropComponentName(componentName: string) {
  const regExp = /^[A-Z](\w+)?[A-Z](\w*)$/;
  return regExp.test(componentName);
}

export function toKebabCase(pascalCase: string) {
  const middleName = pascalCase[0].toLowerCase() + pascalCase.slice(1);
  return middleName.replace(/[A-Z]/g, ($0) => {
    return "-" + $0.toLowerCase();
  });
}
